Repository navigation
crypto: the library sets arm64's DIT around every cryptographic operation, and the lanes' defects are fixed at their cause - #11
Merged
Merged
Conversation
added 22 commits
November 20, 2026 19:51
…res the thread's state, with a seam a test counts
…ing_guard says what its barrier orders
…ate and full_public_key alone in their checks, and compares after
…ers its own timing guard timing_guard takes the std::source_location of its declaration, and the seam WEBCPP_CRYPTO_DETAIL_TIMING_ENTERED(where) passes it on, empty in a program's build. The test seam records the function of the first guard a call enters, and require_enters and covered fail, naming the check, when no guard fired or when that first guard is not the one of the function the check names, read in the spellings of clang, GCC and MSVC with its qualifying scope, so that a forwarder or a function calling another guarded one cannot pass without its own guard. covered_around_callee goes; each coverage file lists the families and functions it covers; BearSSL and OpenSSL also cover AES-192-GCM.
… its outermost parameter list, and refuses a check that names no scope
…he library's own guard gives a program
…ebcpp sets DIT itself
…DIT set or a guard leaves it wrong, and reports each part's fastest and slowest run
…art's spread and UTC dates, explains missing data, and marks the figures measured under load as provisional
… lane without DIT, and the changelog says where webcpp sets DIT
…he seam, so that no guarded function's name or header path reaches a release program on arm64
…h on its own, and refuses malformed data and program lines with a message
…p sets DIT, as the pages do
… which allocate is declared never to do, so the adapter no longer checks a null that release builds removed libc++ and libstdc++ declare std::pmr::memory_resource::allocate returns_nonnull, so the adapter's null check after it was folded away and a null from a test resource was written through (SIGSEGV in clang release, exceptions off). The contract now matches the standard: a resource that cannot allocate throws, and without exceptions ends the process, as std::pmr's own resources do. The failing-resource tests run with exceptions only; adapter's throwing part likewise.
…ect, since GCC 15 at -O3 drops a plain null store in a destructor, and the wipe test reads destroyed storage through a pointer the optimiser cannot follow GCC 15 release builds failed wipe_objects_openssl with -Werror=uninitialized: the test read the bytes of a destroyed object, which GCC takes for indeterminate after the end-of-lifetime clobber of the destructor. With the read made opaque (the storage's address read back from a volatile), the test failed at run time on gcm and chacha20_poly1305: GCC had dropped the std::exchange(context, nullptr) of their resets as a dead store, so the destroyed object still held the freed context's address. The resets now free the contexts and then zero the state with wipe_object, as the other backends do; the test passes, and fails again without the fix.
…h a volatile, as counting_test does, so that GCC 15 at -O3 does not pair the inlined replaced delete's free with operator new
…and the IV once and changes each byte back after its check, which GCC 15 at -O3 no longer reports as an overflowing copy A vector copy inside each iteration made GCC 15 -O3 without exceptions report a memcpy of 2^63 bytes or more in libstdc++'s uninitialized_copy (-Wstringop-overflow) in chacha_openssl_no_exceptions: a false positive, since the sizes come from short hex literals.
…dict, so Pyright sees that the timing figures are read from an object, never from None
…y any optimiser, and collect.py's message names a line that is not an object
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The change
data-independent-timing(proposals,libraries/crypto/openspec/changes/data-independent-timing): crypto sets arm64's DIT itself around every public cryptographic operation, on every backend, and restores the thread's state.detail::timing_guardsets PSTATE.DIT for its scope on arm64 macOS, iOS, Linux and Android where the CPU has FEAT_DIT, and restores what it changed; elsewhere it is empty.WEBCPP_CRYPTO_DETAIL_TIMING_ENTERED(where), exists only where a test defines it; a coverage test per backend proves each function enters its own guard first. A release program keeps no guarded function's name or header path (timing_unseamed_release).dudect_plantedstill finds its leak inside the guard.bench/timing.cppandcollect.py --timingpublish the guard's cost. The figures were measured on a loaded machine and are marked provisional; a final quiet measurement pass follows after the streams of 2026-11-20 merge (design "As built", open item).Defects the local lanes found, fixed here at their cause (each also on main):
allocateis declared never to return null, so release builds removed the OpenSSL adapter's null check and wrote through null with exceptions off.wipe_object; GCC 15 at -O3 dropped the plain null stores in destructors.collect.py.Verified locally (CI deferred by the owner): native clang and gcc-15, wasip2, wasip3 and Emscripten, each debug and release, from scratch, every test and example passing; crypto's tests on arm64 Linux with DIT; the Linux lint (clean) and the macOS lint; MSVC 14.3 and 14.5 under Wine (no failure beyond the known Wine ones); the superproject's tools tests.